<?php
	$admin_info 		= new Zendvn_System_Info();
	$admin_info 		= $admin_info->getMemberInfo();
	//----------------------- INPUT ELEMENTS -------------------//
	$name 				= $this->Item['name'];
	$slbKhoahoc			= $this->Item['khoahoc_name'];
	$ngaykhaigiang		= $this->Item['ngaykhaigiang'];
	$ngayketthuc		= $this->Item['ngayketthuc'];
	
	if($this->Item['status'] == 1){
		$status 		= 'Có';
	}else{
		$status 		= 'Không';
	}
	$order 				= $this->Item['order'];
	$content 			= htmlspecialchars_decode($this->Item['content']);
	
	$optionTrangthai	= array('0' => 'Sắp khai giảng', '1' => 'Đang hoạt động', '2' => 'Đã kết thúc');
	$trangthai			= $optionTrangthai[$this->Item['trangthai']];
?>
<div class="left_content">
	<?php echo $this->render($this->arrParam['controller'] . '/toolbar/left.php');?>
</div>

<div class="right_content">
	<div class="appContent">
		<form action="" method="post" name="appForm">
			<?php echo $this->render($this->arrParam['controller'] . '/toolbar/index.php');?>
			<?php
				//-------------------- SESSAGES ERROR ------------------
				if(count($this->messageError)>0){
					foreach ($this->messageError AS $key => $val){
						echo '<div class="listError" data="'.$key.'" rel="' . $val . '"></div>';
					}
					echo '<div class="thongbaoError goc5">Có lỗi trong quá trình xử lý.</div>';
				} 
			?>
			<div id="tabs">
				<ul>
					<li><a href="#tabs-1">Thông tin chung</a></li>
					<li><a href="#tabs-2">Lịch học</a></li>
				</ul>
				<div id="tabs-1">
					<div class="tblForm">
						<div class="tbl_content">
							<table class="tbl tbl_info">
								<tr>
									<td class="label">Tên lớp học:</td>
									<td><?php echo $name;?></td>
									
									<td class="label">Thứ tự:</td>
									<td><?php echo $order;?></td>
								</tr>
								<tr>
									<td class="label">Chọn khóa học:</td>
									<td><?php echo $slbKhoahoc;?></td>
									
									<td class="label">Hiển thị:</td>
									<td><?php echo $status;?></td>
								</tr>
								<tr>
									<td class="label">Trạng thái:</td>
									<td><?php echo $trangthai;?></td>
								</tr>
								<tr>
									<td class="label">Chọn giáo viên:</td>
									<td>
										<div class="divChonUser" id="divChonGiaoVien">
											<?php
											if(!empty($this->Item['id_giaovien'])){
												$id_giaovien = $this->Item['id_giaovien'];
												if(!is_array($this->Item['id_giaovien'])){
													$id_giaovien = explode(',', $this->Item['id_giaovien']);
												}
												foreach ($id_giaovien AS $key => $val){
													$name_alias = $this->Users[$val]['name'];
													if($this->Users[$val]['alias'] != ''){
														$name_alias = $this->Users[$val]['name'] . ' (' . $this->Users[$val]['alias'] . ')';
													}
													echo '<span class="item goc3" id="'.$this->Users[$val]['id'].'" title="'.$this->Users[$val]['chucvu_name'].' - '.$this->Users[$val]['phongban_name'].'">'.$name_alias.'<a href="javascript:void(0)" class="delete" title="Xóa" onclick="xoaMotUser('.$this->Users[$val]['id'].', \'divChonGiaoVien\')"></a></span>';
													echo '<input id="'.$this->Users[$val]['id'].'" type="hidden" name="id_giaovien[]" value="'.$this->Users[$val]['id'].'">';
												}
											} 
											?>
										</div>
									</td>
								</tr>
								<tr>
									<td class="label">Chọn trợ giảng:</td>
									<td>
										<div class="divChonUser" id="divChonTroGiang">
											<?php
											if(!empty($this->Item['id_trogiang'])){
												$id_trogiang = $this->Item['id_trogiang'];
												if(!is_array($this->Item['id_trogiang'])){
													$id_trogiang = explode(',', $this->Item['id_trogiang']);
												}
												foreach ($id_trogiang AS $key => $val){
													$name_alias = $this->Users[$val]['name'];
													if($this->Users[$val]['alias'] != ''){
														$name_alias = $this->Users[$val]['name'] . ' (' . $this->Users[$val]['alias'] . ')';
													}
													echo '<span class="item goc3" id="'.$this->Users[$val]['id'].'" title="'.$this->Users[$val]['chucvu_name'].' - '.$this->Users[$val]['phongban_name'].'">'.$name_alias.'<a href="javascript:void(0)" class="delete" title="Xóa" onclick="xoaMotUser('.$this->Users[$val]['id'].', \'divChonTroGiang\')"></a></span>';
													echo '<input id="'.$this->Users[$val]['id'].'" type="hidden" name="id_trogiang[]" value="'.$this->Users[$val]['id'].'">';
												}
											} 
											?>
										</div>
									</td>
								</tr>
								<tr>
									<td class="label">Chọn Coach:</td>
									<td>
										<div class="divChonUser" id="divChonCoach">
											<?php
											if(!empty($this->Item['id_coach'])){
												$id_coach = $this->Item['id_coach'];
												if(!is_array($this->Item['id_coach'])){
													$id_coach = explode(',', $this->Item['id_coach']);
												}
												foreach ($id_coach AS $key => $val){
													$name_alias = $this->Users[$val]['name'];
													if($this->Users[$val]['alias'] != ''){
														$name_alias = $this->Users[$val]['name'] . ' (' . $this->Users[$val]['alias'] . ')';
													}
													echo '<span class="item goc3" id="'.$this->Users[$val]['id'].'" title="'.$this->Users[$val]['chucvu_name'].' - '.$this->Users[$val]['phongban_name'].'">'.$name_alias.'<a href="javascript:void(0)" class="delete" title="Xóa" onclick="xoaMotUser('.$this->Users[$val]['id'].', \'divChonCoach\')"></a></span>';
													echo '<input id="'.$this->Users[$val]['id'].'" type="hidden" name="id_coach[]" value="'.$this->Users[$val]['id'].'">';
												}
											} 
											?>
										</div>
										
									</td>
								</tr>
								<tr>
									<td class="label">Nội dung:</td>
									<td colspan="3"><?php echo $content;?></td>
								</tr>
							</table>
						</div>
					</div>
				</div>
				<div id="tabs-2">
					<div class="tblForm">
						<div class="tbl_content">
							<table class="tbl2 tbl_info2">
								<tr>
									<td class="label">Ngày khai giảng:</td>
									<td><?php echo $ngaykhaigiang;?></td>
									
									<td class="label2">Ngày kết thúc:</td>
									<td><?php echo $ngayketthuc;?></td>
								</tr>
							</table>
							
							<div id="listLichhocchon"></div>
							<?php
							$id_lichhoc = '0';
							if(!empty($this->Item['id_lichhoc'])){
								if(is_array($this->Item['id_lichhoc'])){
									$id_lichhoc = implode(',', $this->Item['id_lichhoc']);
								}else{
									$id_lichhoc = $this->Item['id_lichhoc'];
								}
							} 
							?>
							<input type="hidden" id="idLichhocDachon" value="<?php echo $id_lichhoc;?>">
							<script type="text/javascript">
								var id_lichhoc = $('#idLichhocDachon').val();
								$('#listLichhocchon').load('<?php echo $this->baseUrl('default/ajax/ajax-lichhocchon/id_lichhoc/');?>' + id_lichhoc);
							</script>
						</div>
					</div>
				</div>
			</div>
		</form>
	</div>
</div>
<div class="clr"></div>	